package com.ww.yaodao.controller;

import com.ww.yaodao.model.bo.CustomPayInfoDO;
import com.ww.yaodao.model.vo.custom.CustomRespVO;
import com.ww.yaodao.service.CustomPayInfoService;
import com.ww.yaodao.util.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("custompayinfo")
@RestController
@Api(tags = {"订单模块"})
@Slf4j
public class CustomPayInfoController {
    @Autowired
    private CustomPayInfoService customPayInfoService;

    /**
     * 根据订单编号查询数据库中所有符合的订单详情
     * @param orderNum
     * @return
     */
    @GetMapping("getPayInfoList")
    @ApiOperation(value = "根据订单编号查询所有订单")
    public BaseResult<List<CustomPayInfoDO> > infoList(@ApiParam(value = "订单编号") String orderNum){
        List<CustomPayInfoDO> infos = customPayInfoService.infolist(orderNum);
        if (infos!=null){
            return BaseResult.success(infos);
        }
        return BaseResult.error("查询失败",infos);
    }
    @GetMapping("getPayInfoAll")
    @ApiOperation(value = "查询所有订单")
    public CustomRespVO getAllList(){
        log.info("进入客户订单查询....");
        return customPayInfoService.getAllCustom();
    }

}
